package com.tingyuge.thinking.spring.resource.springx;


import org.springframework.util.StreamUtils;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.Charset;

/**
 * 简单的继承handler
 * @author xiaodao
 * @version 1.0
 * @date 2021/8/25
 */
public class Handler extends sun.net.www.protocol.x.Handler {
    //-Djava.protocol.handler.pkgs=com.tingyuge.thinking.spring.resource
    public static void main(String[] args) throws IOException {
        //springx协议 ,就是包名
        URL url = new URL("springx:///META-INF/default.properties");
        final InputStream inputStream = url.openStream();
        System.out.println(StreamUtils.copyToString(inputStream, Charset.forName("utf-8")));
    }
}
